package com.craney.aboutDrawing
{
	import flash.display.Shape;
	import flash.display.Sprite;
	import flash.events.Event;
	import flash.events.TimerEvent;
	import flash.geom.Matrix;
	import flash.utils.Timer;
	
	public class TestMatrix extends Sprite
	{
		private var parentSprite:Sprite;
		
		private var time:Timer = new Timer(30, 0);
		
		private var shp:Shape = new Shape();
		
		public function TestMatrix(ps:Sprite) 
		{
			parentSprite = ps;
			
			graphics.beginFill(0xff0000);
			graphics.drawCircle(0, 0, 10);
			
			
			shp.graphics.lineStyle(3, 0xffcc00);
			shp.graphics.drawRect(-50, -70, 100, 140);
			shp.graphics.drawCircle(0, 0, 3);
			addChild(shp);
			
			var myMatrix:Matrix = shp.transform.matrix;
//			myMatrix.translate(100, 100);
			
			myMatrix.b = Math.tan(Math.PI / 4);
			myMatrix.c = Math.tan(-Math.PI / 4);			
			shp.transform.matrix = myMatrix;
			trace(myMatrix);
			
			time.addEventListener(TimerEvent.TIMER, timeHandler);
//			time.start();
		}

		private function timeHandler(event:Event):void
		{
			var myMatrix:Matrix = shp.transform.matrix;
			
			myMatrix.b = Math.tan(Math.PI / 4);
			myMatrix.c = Math.tan(Math.PI / 4);
			myMatrix.rotate(Math.PI / 90);	
			shp.transform.matrix = myMatrix;
			trace(myMatrix);
		}

	}
}